﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyThuVien.Business;

namespace QuanLyThuVien.Presentation
{
    public partial class frmTKDocGia : Form
    {
        public frmTKDocGia()
        {
            InitializeComponent();
        }

        DocGiaBUS BusDG = new DocGiaBUS();

        TheBUS BusThe = new TheBUS();

        private void rbMaDG_CheckedChanged(object sender, EventArgs e)
        {
            cbTuKhoa.Items.Clear();
            BusDG.LayMaDGLenCB(cbTuKhoa);
        }

        private void rbTenDG_CheckedChanged(object sender, EventArgs e)
        {
            cbTuKhoa.Items.Clear();
            BusDG.LayTenDG(cbTuKhoa);
        }

        private void rbMaThe_CheckedChanged(object sender, EventArgs e)
        {
            cbTuKhoa.Items.Clear();
            BusThe.LoadMaTheLenCB(cbTuKhoa);
        }

        private void btnTimKiemDG_Click(object sender, EventArgs e)
        {
            if (rbMaDG.Checked == true)
            {
                BusDG.LoadLenDG(dgTimKiemDG, cbTuKhoa.Text);
            }
            if (rbTenDG.Checked == true)
            {
                BusDG.LoadLenDGTheoTenDG(dgTimKiemDG, cbTuKhoa.Text);
            }
            if (rbMaThe.Checked == true)
            {
                BusDG.LoadLenDGTheoMaThe(dgTimKiemDG, cbTuKhoa.Text);
            }
        }

        private void frmTKDocGia_Load(object sender, EventArgs e)
        {
            BusDG.LoadLenDG(dgTimKiemDG);
        }

        private void tbnTimKiemNhanh_Click(object sender, EventArgs e)
        {
            BusDG.TimKiemTenDGNhanh(dgTKNhanh, cbTKNhanh.Text);
        }

    }
}
